<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // Object.assign()  用于合并/ 拷贝数组

        // 第一个参数target目标对象  第二个以及以后的参数 数据源对象
        const obj1 = {a:1};
        const obj2 = {b:2};
        const obj3 = {c:3};

        const result = Object.assign(obj1,obj2,obj3);
        console.log(Object.is(obj1,result));//true

        const obj4 = {...obj1,...obj2,...obj3};
        console.log(obj4);

        // 用来做对象的拷贝  生成新的对象
        const obj5 = Object.assign({},obj4);
        obj4.a = 100;
        console.log(obj4,obj5);

        let obj6 = {...obj4}
        obj4.b = 100;
        console.log(obj4,obj6);

    </script>
</body>
</html>